cmake_minimum_required(VERSION 3.9)

project(jklibs)

include(./tools/${MODEL}.cmake)

include_directories(common)
include_directories(common/misc)
include_directories(common/ex)
include_directories(common/funcs)
include_directories(third/jsoncpp)
include_directories(third)
include_directories(common/storage)
include_directories(common/codec)

message("opencv base ${OPENCV_PATH}")

include_directories(${X264_PATH}/include)
include_directories(${X265_PATH}/include)
include_directories(${OPENCV_PATH}/include)
include_directories(${OPENCV_PATH}/include/opencv4)
include_directories(${PLAT_PATH}/include)
link_directories(${X264_PATH}/lib)
link_directories(${X265_PATH}/lib)
link_directories(${OPENCV_PATH}/lib)
link_directories(${PLAT_PATH}/lib)

include_directories(${SQLITE3_ROOT}/include)
link_directories(${SQLITE3_ROOT}/lib)
include_directories(${OPENSSL_ROOT}/include)
link_directories(${OPENSSL_ROOT}/lib)

option(WINDOWS "windows platform" OFF)
option(LINUX "linux platform" OFF)
option(WITH_GCC_HIGH "gcc high version" ON)
option(WITH_OPENCV "opencv need 4.0" OFF)
option(common/codec "common/codec" OFF)
option(CMAUTOTEST "Auto test" OFF)
option(WITH_DATABASE "database function support" OFF)
option(WITH_LIBCURL "libcurl support" OFF)
option(WITH_COAP "coap suport" OFF)
option(WITH_QT "qt support" OFF)
option(WITH_VDEV "qt support" OFF)
option(WITH_DBUSCPP "DBus cpp function" OFF)

if (WITH_COAP)
	include_directories(${COAP_PATH}/include)
	link_directories(${COAP_PATH}/lib)
endif ()

if (WITH_GCC_HIGH)
	add_definitions(-DGCC_HIGH)
endif()

MESSAGE(STATUS "System is ${CMAKE_SYSTEM_NAME}")

if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
	set(LINUX ON)
endif()

if (WITH_LIBCURL)
	add_definitions(-DUSE_LIBCURL)
	include_directories(${LIBCURL_PATH}/include)
	link_directories(${LIBCURL_PATH}/lib)
	set(CURL_LIB curl)
endif()
if (WITH_MQTT)
	message("with mqtt on")
	add_definitions(-DUSE_MQTT_MOSQ)
	include_directories(${MOSQ_PATH}/include)
	link_directories(${MOSQ_PATH}/lib)
endif()

IF (LINUX)
message(STATUS "This is linux platform")
ENDIF()

set(COMMON_EX_JSON_FILES
		third/jsoncpp/json/allocator.h
		third/jsoncpp/json/assertions.h
		third/jsoncpp/json/autolink.h
		third/jsoncpp/json/features.h
		third/jsoncpp/json/forwards.h
#		third/jsoncpp/json/config.h
		third/jsoncpp/json/json.h
		third/jsoncpp/json_reader.cpp
		third/jsoncpp/json/json_tool.h
		third/jsoncpp/json_value.cpp
		third/jsoncpp/json_writer.cpp
		third/jsoncpp/json/reader.h
		third/jsoncpp/json/value.h
		third/jsoncpp/json/version.h
		third/jsoncpp/json/writer.h
		)

add_library(third_jsoncpp
${COMMON_EX_JSON_FILES}
)

add_subdirectory(base_study)
add_subdirectory(common)
add_subdirectory(services)
add_subdirectory(hal)

add_subdirectory(app)


